fix: propagate parent instance info in in-memory backend#263
Merged
YunchuWang merged 2 commits intoJun 12, 2026
Merged
Conversation
…yOrchestrationBackend InMemoryOrchestrationBackend.createInstance() did not accept or forward parent instance info to the ExecutionStartedEvent, causing ctx.parent to always be undefined for sub-orchestrations in the test environment. The fix adds an optional parentInstance parameter to createInstance() and passes the parent orchestration's name, instanceId, and taskScheduledId from processCreateSubOrchestrationAction(). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
6f7d1d3 to
9116511
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR closes the behavioral gap between the real sidecar and the in-memory test backend by propagating parent orchestration instance metadata into ExecutionStartedEvent for sub-orchestrations, enabling ctx.parent to be populated correctly during tests.
Changes:
- Added an optional
parentInstanceparameter toInMemoryOrchestrationBackend.createInstance()and forwarded it intonewExecutionStartedEvent(...). - Updated sub-orchestration creation to supply parent instance metadata (name, instanceId, taskScheduledId).
- Added regression tests to verify
ctx.parentis set for sub-orchestrations and remainsundefinedfor top-level orchestrations.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/durabletask-js/src/testing/in-memory-backend.ts | Threads parent instance metadata into the in-memory backend’s ExecutionStartedEvent for sub-orchestrations. |
| packages/durabletask-js/test/in-memory-backend.spec.ts | Adds coverage validating parent metadata propagation behavior in the test backend. |
Use the shared ParentOrchestrationInstance type for in-memory backend parent metadata instead of redefining the shape inline. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
kaibocai
approved these changes
Jun 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #243